#include "bits/stdc++.h"

using namespace std;

const int N = 105;

int sum1[N][N], sum2[N][N];

vector<int> getBiggestThree(vector<vector<int>> &grid)
{
    set<int> s;
    // init
    int m = grid.size(), n = grid[0].size();
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < n; j++)
        {
            sum1[i][j] = sum2[i][j] = grid[i][j];
            if (j + 1 < n && i)
                sum1[i][j] += sum1[i - 1][j + 1];
            if (j - 1 >= 0 && i)
                sum2[i][j] += sum2[i - 1][j - 1];
        }
    }

    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < n; j++)
        {
            s.insert(grid[i][j]);
            for (int k = 1; k < min(n, m); k++)
            {
                if (j - k < 0 || j + k >= n || i - k < 0 || i + k >= m)
                    continue;

                int area = sum1[i][j-k]-sum1[i-k][j];
                area += sum1[i+k][j] - sum1[i][j+k];
                area += sum2[i][j+k] - sum2[i-k][j];
                area += sum2[i+k][j] - sum2[i][j-k];

                area += grid[i-k][j];
                area -= grid[i+k][j];

                s.insert(area);
            }
        }
    }

    while (s.size() > 3)
        s.erase(s.begin());

    return vector<int>(s.rbegin(), s.rend());
}

int main()
{
    int n, m;
    cin >> m >> n;
    vector<vector<int>> grid;
    for (int i = 0; i < m; i++)
    {
        vector<int> temp;
        for (int j = 0; j < n; j++)
        {
            int a;
            cin >> a;
            temp.push_back(a);
        }
        grid.push_back(temp);
    }

    for (auto i : getBiggestThree(grid))
    {
        cout << i << " ";
    }
    cout << endl;
    return 0;
}
/*
1 3
7 7 7

5 5
3 4 5 1 3
3 3 4 2 3
20 30 200 40 10
1 5 5 4 1
4 3 2 2 5
*/